import request from '@/apis/api.interceptor.js'
// api 接口管理
const install = (Vue, vm) => {

	Vue.prototype.apis = {
		// wxInfo: (json={},params = {}) => http.post('/api/applet/user/getWxOpenidInfo', json,{params}),
		// authPhone: (params = {}) => http.get('/api/applet/user/auth/phone', {params}),
		// dictList: (params = {}) => http.get('/api/app/config/dictList', {params}),
		// upload: (filePath) => http.upload('/api/common/fileUpload', filePath),
		// delFile: (params) => http.post('/api/common/fileDelete',{}, {params}),
		// login: (data, params) => request.post('/api/applet/user/login', data, {
		// 	params: params
		// }),
		// register: (data) => request.post('/api/applet/user/register', data),
		getUser: () => request.post('/api/app/user/get'),
		//修改用户信息
		userUpd: (data) => request.post('/api/app/user/upd', data),
		// config: () => request.get('/api/app/config/get'),
		//广告
		adList: (data) => request.get('/api/app/advert/list', data),
		//分类
		classList: (data) => request.get('/api/app/goods/getClass', data),
		//商品列表
		// goodsList: (data) => request.get('/api/app/goods/pages', data, {
		// 	custom: {
		// 		ShowLoading: false
		// 	}
		// }),
		goodsList: (data) => request.get('/manage/petGoods/list', data, {
			custom: {
				ShowLoading: false
			}
		}),
		//商品详情
		goodsDetail: (data) => request.get('/manage/petGoods/detail', data),
		//确认收货 id
		goodsOver: (params) => request.post('/api/app/goods/overGoods', {}, {
			params: params
		}),
		//分类与商品列表
		// classAndGoods: () => request.get('/api/app/goods/getGoodsAndClass'),
		//商家信息
		getShop: (data) => request.get('/api/app/goods/getShop', data),
		//商家信息-当前登陆人的
		myShop: () => request.get('/api/app/user/shop'),
		//购物车列表数量
		getCarCount: () => request.get('/api/app/goods/getCarCount', {}, {
			custom: {
				ShowLoading: false
			}
		}),
		//购物车商品总数
		getCarGoodsCount: () => request.get('/api/app/goods/getCarGoodsCount', {}, {
			custom: {
				ShowLoading: false
			}
		}),
		//加入购物车
		addCar: (params) => request.post('/api/app/goods/addCar', {}, {
			params: params,
			custom: {
				ShowLoading: false
			}
		}),
		//获取购物车列表
		// getCar: () => request.get('/api/app/goods/getCar'),
		//删除购物车商品
		// delCar: (params) => request.post('/api/app/goods/delCar', {}, {
		// 	params: params
		// }),
		//清空购物车
		// clearCar: () => request.post('/api/app/goods/clearCar'),
		//用户收货地址列表
		// addrList: () => request.get("/api/app/address/list"),
		//收货地址详情
		// addrGet: (data) => request.get("/api/app/address/get", data),
		//默认收货地址
		// addrDefault: () => request.get("/api/app/address/getDefault"),
		//设置默认地址
		// addrSet: (params) => request.post("/api/app/address/setDefault", {}, {
		// 	params: params
		// }),
		//添加修改地址
		addrSave: (data) => request.post("/api/app/address/save", data),
		//删除地址
		// addrDel: (params) => request.delete("/api/app/address/delete", {}, {
		// 	params: params
		// }),
		//提交订单支付
		// pay: (data, params) => request.post("/api/app/goods/pay", data, {
		// 	params: params
		// }),
		//订单列表
		recordPage: (data) => request.get("/api/app/goods/recordPage", data),
		//订单详情
		recordById: (data) => request.get("/api/app/goods/recordById", data),
		//订单统计
		recordCount: (data) => request.get("/api/app/goods/recordCount", data),
		//帮助中心 pageNum pageSize type1帮助中心 2菜谱
		helpList: (data) => request.get("/api/app/richtext/list", data),
		//帮助中心 
		helpDetail: (data) => request.get("/api/app/richtext/get", data),
		//意见反馈 param: opinion
		opinionPut: (params) => request.post("/api/app/opinion/save", {}, {
			params: params
		}),
		//会员操作
		//会员注册
		registerMember: (data) => request.post("/manage/member/register", data),
		//会员登录
		loginMember: (data) => request.post("/manage/member/login", data),
		//获取会员信息
		getMember: () => request.post("/manage/member/getMember"),
		//获取收货地址列表
		addrList: () => request.get("/manage/petAddress/listByUserId"),
		//获取默认收货地址
		addrDefault: () => request.get("/manage/petAddress/getDefault"),
		//商品模块
		//分类与商品列表
		classAndGoods: () => request.get('/manage/petGoods/getTypeAndGoods'),
		
		//购物车模块
		//获取购物车
		getCar: () => request.get('/manage/petCart/listByUserId'),
		addCar: (data) => request.post("/manage/petCart/add", data),
		editCar: (data) => request.post("/manage/petCart/edit", data),
		clearCar: () => request.delete('/manage/petCart/deleteAll'),
		
		
		//添加修改地址
		addrAddr: (data) => request.post("/manage/petAddress/add", data),
		//删除地址
		addrDel: (params) => request.delete("/manage/petAddress/delete", {}, {
			params: params
		}),
		//修改地址
		addrEdit: (data) => request.post("/manage/petAddress/edit", data),
		//设置为默认地址
		addrDefaultSet: (data) => request.post("/manage/petAddress/edit", data),
		//收获地址详情
		addrDeatil: (data) => request.get("/manage/petAddress/detail", data),
		
		//订单
		addOrder: (data) => request.post("/manage/petOrder/generateOrder", data),
		//订单列表
		listOrderByUserId: (params) => request.get('/manage/petOrder/listByUserId',{},{
			params: params
		}),
		listSubOrderByUserId: (params) => request.get('/manage/petSubscribeOrder/listByUserId',{},{
			params: params
		}),
		//获取预约服务类型
		listSubscribeType: () => request.get('/manage/petSubscribeType/getList'),
		//添加预约服务
		addSubscribe: (data) => request.post("/manage/petSubscribe/save", data),
		getSubscribe: (params) => request.get('/manage/petSubscribe/listByUserId',{},{
			params: params
		}),
		listByUserId: (params) => request.get('/manage/petSubscribe/listByUserId',{},{
			params: params
		}),
		logout: (data) => request.post("/auth/security/logout"),
		
	};
}

export default {
	install
}
